from rest_framework import serializers
from .models import Product

class ProductSerializer(serializers.ModelSerializer):
    # category_id = serializers.CharField(source='category.category_id',read_only=True)
    category_name = serializers.CharField(source='category.category_name',read_only=True,)
    class Meta:
        model = Product
        fields = ('category_name','name','description','price','stock','is_available','create_time')

